<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="{{ asset('assets/favicon.ico') }}" >
    <title>{% block title %} {% endblock %}</title>
    <link href="{{ asset('assets/css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/css/l-style.css') }}" rel="stylesheet">
     <style type="text/css">
        .layout-href{
            position: absolute;
            bottom: 8px;
            font-size: 14px;
            text-align: center;
            color: #95a0aa;
            display: block;
            width: 100%;
        }
        .layout-href:hover{
            color: #fff;
        }
    </style>

    {% block css %}{% endblock %}

    <script src="{{ asset('assets/js/jquery-1.9.1.min.js') }}"></script>
    <script src="{{ asset('assets/js/bootstrap.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('assets/js/pop_status.js') }}"></script>
    <script src="{{ asset('assets/js/common.js') }}"></script>
    <script>

        function logout(){
            $.post("{{ path('api_platform_auth_logout') }}",{},function(data){
                if(data.errorCode == 0){
                    popStatus(1,data.message,1,"{{ path('plat_auth_login') }}",true);
                } else {
                    popStatus(2,data.message,1,"",true);
                }
            })
        }

        //获取侧边栏高度
        setTimeout(function() {
            $('.panel-group').height($('.main-content').height());
            $('.layout-href').show();
        }, 1000);

    </script>
</head>
<body>
<div class="container">

    {% block top %}
    <div class="header">
        <div class="header-fl fl">科技小桌板</div>
        <div class="header-fr fr">
            <img src="{{ asset('assets/img/icon/default-avatar.png') }}" width="28" height="28" class="default-avatar fl">
            <span class="admin-name fl">{{ app.session.get("plat_name") }}</span>
            <img src="{{ asset('assets/img/icon/exit-icon.png') }}" width="16" height="16" class="login-exit fr" onclick="logout()">
        </div>
    </div>
    {% endblock %}


    {% block left_body_top %}
    <div class="super-admin">
        <img src="{{ asset('assets/img/icon/p-admin.png') }}" width="70" height="71">
        <span class="super-text">平台管理员</span>
    </div>
    {% endblock %}


    {% block left_body %}
    <div class="sidebar">
        <div class="panel-group" id="accordion" style="position: relative;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="1" href="{{ path('plat_index') }}">
                                <span class="sidebar-icon">
                                    <span class="side1"></span>
                                </span>
                                <span class="">首页</span>
                                <span class="r-arrow r-arrow-c"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="2" href="{{ path('plat_district_index') }}">
                                <span class="sidebar-icon">
                                    <span class="area-side"></span>
                                </span>
                                <span class="">区域管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="3" href="{{ path('plat_medal_list') }}">
                                <span class="sidebar-icon">
                                    <span class="model-side"></span>
                                </span>
                                <span class="">勋章管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="4" href="{{ path('plat_company_list') }}">
                                <span class="sidebar-icon">
                                    <span class="side4"></span>
                                </span>
                                <span class="">企业信息查询</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div data-toggle="collapse" data-parent="#accordion" href="#collapseEight">
                            <a class="sidebar-list" data-id="8">
                                <span class="sidebar-icon">
                                    <span class="side8"></span>
                                </span>
                                <span class="">系统设置</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
                <div id="collapseEight" class="panel-collapse collapse">
                    <div class="panel-body">
                        <ul class="son-sidebar">
                            <li>
                                <a class="sidebar-son-list" href="{{ path('plat_setting_index') }}" data-id="1">个人信息</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('plat_update_password') }}" data-id="2">修改密码</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('plat_admin_account_list') }}" data-id="3">超级管理员账号管理</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('plat_setting_banner_list') }}" data-id="4">Banner图管理</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('plat_get_link') }}" data-id="5">超链接管理</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <a href="" class="layout-href" style="display: none;">π+派伽提供技术支持</a>
        </div>
    </div>
    {% endblock %}


    {% block right_body %}


    {% endblock %}

    {% block body %}{% endblock %}


{% block box %}
{% endblock %}


{% block javascript %}
    <script type="text/javascript">

        // 分页
        function pageAction(count,allpage){

            console.log(count);
            $(".pagination").empty();

            var html = '';
            html += '<li><a href="javascript:;" class="last-page" data-allcount="'+ allpage +'">&laquo;</a></li>';

            for(var i=0;i<allpage;i++){

                var key = parseInt(i)+1;

                if(i== 0){
                    html += '<li><a href="javascript:;" class="mes-page-check" data-allcount="'+ allpage +'">'+ key +'</a></li>';
                } else {
                    html += '<li><a href="javascript:;" data-allcount="'+ allpage +'">'+ key +'</a></li>';
                }

            }

            html += '<li><a href="javascript:;" class="next-page" data-allcount="'+ allpage +'">&raquo;</a></li>';

            $(".pagination").append(html);
        }

        // 分页点击事件
        $("body").on("click",".pagination li a",function(){
            var $this = $(this);
            var curr_page =  parseInt($(".mes-page-check").text());

            var all_count = parseInt($(this).data("allcount"));


            // 判断点击按钮
            var is_next = $(this).hasClass("next-page");
            var is_last = $(this).hasClass("last-page");


            // 点击下一页
            if(is_next && curr_page < all_count){

                $(".pagination li a").removeClass("mes-page-check");
                var now_page = parseInt(curr_page + 1);
                $(".pagination li a").each(function(){
                    var _this = $(this);
                    if(parseInt( _this.text()) == now_page){
                        _this.addClass("mes-page-check");
                        $("table tbody").empty();
                        addSearchAction(now_page);

                    }

                })

            }

            // 点击上一页
            if(is_last && curr_page > 1){

                $(".pagination li a").removeClass("mes-page-check");
                var now_page = parseInt(curr_page - 1);
                $(".pagination li a").each(function(){
                    var _this = $(this);
                    if(parseInt( _this.text()) == now_page){
                        _this.addClass("mes-page-check");
                        $("table tbody").empty();
                        addSearchAction(now_page);

                    }

                })
            }

            // 点击页码
            if(!is_next && !is_last){
                $(".pagination li a").removeClass("mes-page-check");
                $this.addClass("mes-page-check");
                $("table tbody").empty();
                var this_page = $this.text();
                addSearchAction(this_page);
            }
        })

    </script>
{% endblock %}

</body>
</html>
